<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //objec.assgin()
        //将多个对象的属性和方法都合并到目标对象上面
        //格式是（目标对象，后面跟着多个或者一个原对象）
        let target = {} //目标对象
        let name1 = {
            name: 'img',
            age: '123'
        }
        let name2 = {
            sex: '男'
        }
        let name3 = {
            sex: '女'
        }
        Object.assign(target, name1, name2, name3);
        console.log(target);



        //objec.assgin()
        //将多个对象的属性和方法都合并到目标对象上面
        //格式是（目标对象，后面跟着多个或者一个原对象）
        let target = {} //目标对象
        let name1 = {
            name: 'img',
            age: '123'
        }
        let name2 = {
            sex: '男'
        }
        let name3 = {
            sex: '女'
        }
        Object.assign(target, name1, name2, name3);
        console.log(target);



        //objec.assgin()
        //将多个对象的属性和方法都合并到目标对象上面
        //格式是（目标对象，后面跟着多个或者一个原对象）
        let target = {} //目标对象
        let name1 = {
            name: 'img',
            age: '123'
        }
        let name2 = {
            sex: '男'
        }
        let name3 = {
            sex: '女'
        }
        Object.assign(target, name1, name2, name3);
        console.log(target);
    </script>
</body>

</html>